
$('#searchInput2').on('input', function () {
    // 获取搜索输入框的值并转换为小写
    var searchText = $(this).val().toLowerCase();
    // 遍历表格主体中的每一行
    $('#default-datatable tbody tr').each(function () {
        // 获取行中每个单元格的文本内容并转换为小写
        var cellText = $(this).text().toLowerCase();
        // 根据是否包含搜索文本来显示或隐藏行
        $(this).toggle(cellText.indexOf(searchText) > -1);
    });
});

//将当前表格行的数据回填到模态框中span标签里面
$('#table-body').on('click','.browse',function (){
    console.log('success');
    let currentRow = $(this).closest('tr');
    let id=currentRow.find('td:eq(0)').text();
    let aliasName=currentRow.find('td:eq(1)').text();
    let profile=currentRow.find('td:eq(2)').text();//获取当前行的作者个人简介
    let wechat=currentRow.find('td:eq(4)').text();
    let username=currentRow.find('td:eq(3)').text();
    let authorid=document.getElementById('authorid');
    let authorAliasName=document.getElementById('authorAliasName');
    let authorUserName=document.getElementById('authorUsername');
    let wx=document.getElementById('wechat');
    let authorProfile=document.getElementById('profile');
    authorid.textContent=id;
    authorAliasName.textContent=aliasName;
    authorUserName.textContent=username;
    wx.textContent=wechat;
    authorProfile.textContent=profile;
    let status=-1;
    $('#deleteInfo').on('click',function (){//审核不通过
        currentRow.remove();
        status=0;
        $.ajax({
            type:"POST",
            url:"/examine/deleteInfo",
            data:{id:id,status:status},
            success:function (){
                cocoMessage.success('操作成功');
            },
            error:function (error){
                console.log(error);
            }
        })
    })
    $('#passInfo').on('click',function (){
       console.log('pass');
        status=1;
        console.log(id);
        console.log(status);
        $.ajax({
            type: "POST",
            url:"/examine/deleteInfo",
            data:{id:id,status:status},
            success:function (){
                currentRow.remove();
                cocoMessage.success('核验成功');
            },
            error:function (error){
                cocoMessage.error('操作失败');
                console.log(error);
            }
        })
    })

})
